#pragma once
#include "BaseFunByOneVar.h"

namespace Net
{

class FunByAbs : public BaseFunByOneVar
{
public:
    FunByAbs() : BaseFunByOneVar(FunType_E::Abs_E, "Abs")
    {

    }

    ~FunByAbs()
    {

    }

    Value_t runFun(Value_t x) final
    {
        return std::fabs(x);
    }

    Value_t runDiff(Value_t x) final
    {
        return x < -std::numeric_limits<Value_t>::epsilon() ? -1 : (x > std::numeric_limits<Value_t>::epsilon() ? 1 : 0);
    }
};

}